package com.yw.swagger.controller;

import com.yw.swagger.customNote.fyh;
import com.yw.swagger.model.SysBpsGpmemlnk;
import com.yw.swagger.service.SysBpsGroupsService;
import com.yw.swagger.tool.AjaxResult;
import com.yw.swagger.tool.Ztree;
import com.yw.swagger.tool.controller.BaseController;
import com.yw.swagger.tool.page.TableDataInfo;
import io.swagger.annotations.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;


@Controller
@Api(tags="查询人员")
@RequestMapping("/groups")
public class SysBpsGroupsController extends BaseController {

    @Autowired
    private SysBpsGroupsService SysBpsGroupsService;


    @fyh
    @ApiOperation(value = "查询人员",notes = "查询人员")
    @ApiImplicitParam(name="author",value="权限码",required = true)
    @ApiResponses({@ApiResponse(code = 200,message = "成功"),@ApiResponse(code = 500,message = "error")})
    @PostMapping("/ztree")
    @ResponseBody
    public AjaxResult allList() {
        List<Ztree>l=SysBpsGroupsService.selectSysBps();
        TableDataInfo td = getDataTable(l);
        AjaxResult ar = new AjaxResult(AjaxResult.Type.SUCCESS,null);
        ar.put("rows",td.getRows());
        ar.put("total",td.getTotal());
        return  ar;
    }

    @fyh
    @ApiOperation(value = "查询局领导人员",notes = "查询局领导人员")
    @ApiImplicitParam(name="author",value="权限码",required = true)
    @ApiResponses({@ApiResponse(code = 200,message = "成功"),@ApiResponse(code = 500,message = "error")})
    @PostMapping("/bureauPerson")
    @ResponseBody
    public AjaxResult bureauPerson() {
        List<SysBpsGpmemlnk> list=SysBpsGroupsService.selectbureauPerson();
        TableDataInfo td = getDataTable(list);
        AjaxResult ar = new AjaxResult(AjaxResult.Type.SUCCESS,null);
        ar.put("rows",td.getRows());
        ar.put("total",td.getTotal());
        return ar;
    }

    @fyh
    @ApiOperation(value = "查询办公室人员",notes = "查询办公室人员")
    @ApiImplicitParam(name="author",value="权限码",required = true)
    @ApiResponses({@ApiResponse(code = 200,message = "成功"),@ApiResponse(code = 500,message = "error")})
    @PostMapping("/workPerson")
    @ResponseBody
    public AjaxResult workPerson() {
       List<SysBpsGpmemlnk> list=SysBpsGroupsService.selectworkPerson();
        TableDataInfo td = getDataTable(list);
        AjaxResult ar = new AjaxResult(AjaxResult.Type.SUCCESS,null);
        ar.put("rows",td.getRows());
        ar.put("total",td.getTotal());
        return ar;
    }


}
